#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2018-12-05 16:26
# @Author  : 少爷

a = 2.0
b = 1.0
s = 0

for n in range(1, 21):
    s += a / b
    t = a
    a = a + b
    b = t

print s

a = 2.0
b = 1.0
s = 0

for n in range(1, 21):
    s += a / b
    b, a = a, a + b

print s

s = 0.0

for n in range(1, 21):
    s += a / b
    b, a = a, a + b

print s

a = 2.0
b = 1.0
l = []

for n in range(1, 21):
    b, a = a, a + b
    l.append(a / b)

print reduce(lambda x, y: x + y, l)
